/*
 * @Author: your name
 * @Date: 2021-06-26 22:21:23
 * @LastEditTime: 2021-06-26 22:28:12
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 */

import { Entity, EntityType } from "./Entity";
import { Player } from "./Player";

export class EntityManager {
    // 单例
    private static _inst: EntityManager;
    static get inst() {
        if (this._inst) {
            return this._inst;
        }

        this._inst = new EntityManager();
        return this._inst;
    }

    // main player
    private mainPlayer: Player = null;
    public setMainPlayer(plr: Player) {
        this.mainPlayer = plr;
    }
    public getMainPlayer(): Player {
        return this.mainPlayer
    }

    public createEntity(etype: EntityType): Entity {
        switch (etype) {
            case EntityType.Player: {
                return new Player();
            }
            // case EntityType.Npc: {
            //     return ne
            // }
        }
        return null;
    }
}